/**
 * @fileoverview Test Archetype.addJs
 */
(function() {
    var scripts = [];

    function setup () {
        scripts = [];
        Archetype.scriptElement = {
            parentNode : {
                appendChild : function(script){
                    scripts.push(script);
                }
            }
        };
    }
    
    doh.registerGroup("test.loadJSFiles", [

        function testSetCharsetOnJsFiles() {
            setup();
            Archetype.addJS(Archetype.path+"Archetype/unitTest/data/testFile.js");
            doh.assertEqual(1, scripts.length);
            doh.assertEqual("iso-8859-1", scripts[0].charset);
            //in order to have no error
            scripts[0].loaded=true;
        },

        function testChangeDefaultCharset() {
            setup();
            Archetype.charset = "utf-8";
            Archetype.addJS(Archetype.path+"Archetype/unitTest/data/testFile.js");
            doh.assertEqual(1, scripts.length);
            doh.assertEqual("utf-8", scripts[0].charset);
            //in order to have no error
            scripts[0].loaded=true;
        }

        ]);
})();